<template>
  <div class="pingpaixinagqing">
    <van-nav-bar
      title="品牌列表"
      left-text="返回"
      fixed
      left-arrow
      @click-left="$router.back()"
    />
    <!-- 列表 -->
    <div class="xfqhsyyds">
      <van-list
        v-model="loading"
        :finished="finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        <ul class="list">
          <li
            class="item"
            @click="$router.push(`/pinpai?id=${item.id}`)"
            v-for="item in list"
            :key="item.id"
          >
            <img :src="item.app_list_pic_url" alt="" />
            <p>{{ item.name }}|{{ item.floor_price }}元起</p>
          </li>
        </ul>
      </van-list>
    </div>
  </div>
</template>

<script>
import { listaction } from "@/api/品牌制造商/pinpai.js";
export default {
  name: "Ppxq",
  data() {
    return {
      list: [],
      loading: false,
      finished: false,
      page: 1,
    };
  },
  methods: {
    onLoad() {
      listaction({
        params: this.page,
      }).then((res) => {
        console.log(res);
        this.list.push(...res.data.data);
        this.loading = false;
        this.page++;
        if (this.page > res.data.total) {
          this.finished = true;
        }
      });
    },
  },
};
</script>

<style lang="less" scoped>
.pingpaixinagqing {
  .xfqhsyyds {
    margin-top: 50px;
    .list {
      list-style: none;
      display: flex;
      flex-direction: column;
      flex-wrap: nowrap;
      align-items: center;
      align-content: center;
      .item {
        position: relative;
        width: 100%;
        height: 230px;
        margin-bottom: 3px;
        img {
          width: 100%;
          height: 100%;
        }
        p {
          position: absolute;
          top: 50%;
          left: 50%;
          transform: translate(-50%, -50%);
          font-size: 16px;
          color: rgb(0, 0, 0);
          font-weight: 700;
        }
      }
    }
  }
}
</style>